# 字典：key-value
scores ={"李四":100,"王五":80}
print("王五"in scores)
print(scores["李四"])
print(scores.get("王五"))
scores.pop("李四")
print(scores)
scores["lucy"]=95
scores["马丁"]=77
print(scores)
for key in scores:
    print(key)
for key in scores:
    print(scores[key],scores.get(key))
print(scores.values())
del scores["lucy"]
print(scores)

# 集合：一组key集合，无value,无序且不可重复
s = set(range(6))
print(s)
print(set((3,4,5)))
print(set([3,4,5]))
print(set("python"))
s.pop()
print(s)
s.remove(1)
print(s)
s.discard(45)#无值不报错
s.add("apple")
print(s)
s.update(("凤梨","猕猴桃"))
print(s)
s.clear()
print(s)
s = {i*i for i in range(0,5)}
s1 ={1,4,6}
print(s == s1)
print(s & s1)
print(s | s1)
print(s - s1)
print(s ^ s1)

#可变对象与不可变对象(是否可以增删改，地址是否发生变化)
a = ['c','b','a']
a.sort()
print(a)

a = 'abc'
a1 = a.replace('a','l')
print(a is a1)
print(a1,id(a1),id(a))

s = set(range(6))
print(s,id(s))
s.update((7,8,9))
print(s,id(s))
